package com.bucg.cjcloud.gb28181.sip.process;

import com.bucg.cjcloud.gb28181.sip.modle.ResponseModel;
import com.bucg.cjcloud.gb28181.sip.handler.CatalogHandler;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;

import javax.sip.message.Request;

@Component
@Order(2)
public class CatalogRequestProcess implements RequestProcess {
    @Autowired
    CatalogHandler catalogHandler ;

    @Override
    public ResponseModel processRequest(Request req, String cmdType) {
        // System.out.println("catalog...");
        // System.out.println(new String(req.getRawContent()));
        // CatalogResp catalog = new CatalogResp();
        // catalog.setCmdType(CmdTypeEnmu.valueOf(cmdType));
            catalogHandler.handler(null, req);
        return ResponseModel.builder().statusCode(200).build();
    }

    @Override
    public boolean isSupport(Request req, String cmdType) {


        return cmdType != null && cmdType.equalsIgnoreCase("catalog");
        //return Request.MESSAGE.equals(method)&&content!=null&&content.contains("CmdType")&&content.contains("Catalog");
    }


}
